/**
 * @author: Gene
 * @age: 永远18岁的美少年
 * @Email： yangjianyun@58.com
 * @date: 2021-12-23 09:46:47
 * @description: 枚举类型
 */

/** 1. 枚举的定义 */
enum Direction {Up, Down, Left, Right}

enum Months {January, February, March, April, May, June, July, August, September, October, November, December }

enum Size {big = "大", middle = "中", small = "小"}

/** 2. 数字枚举和 字符串枚举 */

/**
 * 声明一个枚举类型, 如果没有赋值, 它的默认值为  数字类型, 且从 0 开始,自动累加
 */
enum Months1 {
    Jan,
    Feb,
    Mar,
}

console.log(Months1.Jan);
console.log(Months1.Feb);
console.log("----------------------");

// 定义枚举值从 1 开始自增
enum Months2 {
    Jan = 1,
    Feb,
    Mar,
}

console.log(Months2.Jan);
console.log(Months2.Feb);

/** 3. 枚举的合并 */
enum Months3 {
    Jan = 1,
    Feb,
    Mar,
    Apr
}

enum Months3 {
    May = 5,
    Jun
}

console.log(Months3.Apr) // 4
console.log(Months3.Jun) // 6